import { create } from 'zustand'
import type { POIData } from '@/components/HospitalMapViewer'

interface POIIntent {
  center?: [number, number]
  zoom?: number
  pois?: POIData[]
}

interface POIIntentState {
  intent: POIIntent | null
  setIntent: (intent: POIIntent) => void
  clearIntent: () => void
  consumeIntent: () => POIIntent | null
}

const usePOIIntentStore = create<POIIntentState>((set, get) => ({
  intent: null,
  setIntent: (intent) => set({ intent }),
  clearIntent: () => set({ intent: null }),
  consumeIntent: () => {
    const current = get().intent
    set({ intent: null })
    return current
  }
}))

export default usePOIIntentStore
export type { POIIntent }

